/* Copyright (C) 2010 Fredrique Samuels, fredriquesamuels@gmail.com 

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TRI_KEY_HANDLER_H__
#define _TRI_KEY_HANDLER_H__

#include "sigslot/sigslot.h"

namespace tri{

class TKeyHandler:public sigslot::has_slots<sigslot::multi_threaded_local>{
public:
	TKeyHandler(){clear();}
	virtual ~TKeyHandler(){}
	
	inline void released(int c){mKeys[c]=false;}
	inline void pressed(int c){mKeys[c]=true;}
	inline bool isPressed(int c){return mKeys[c];}
	
	void clear(){
		for (int i=0;i<256;i++){
			mKeys[i]=false;
		}
	}
private:
	bool mKeys[256];
};

}

#endif
